import axios from 'axios'

let baseUrl = 'http://localhost:3000'
// 获取轮播图的api
export function getBanner(type=1){
    return axios.get(`${baseUrl}/banner?type=${type}`)
     
}

// 获取推荐歌单
export function getMusicList(limit=10) {
    return axios.get(`${baseUrl}/personalized?limit=${limit}`)
}

// 获取歌单详情列表
export function getPlaylistDetail(id) {
    return axios.get(`${baseUrl}/playlist/detail?id=${id}`)
}

// 获取歌词
export function getLyric(id) {
    return axios.get(`${baseUrl}/lyric?id=${id}`)
}
// export function getLyric() {
//     return axios.get(`${baseUrl}/lyric?id=1486513704`)
// }

// 搜索歌曲
export function searchMusic(keyword) {
    // /search?keywords= 海阔天空
    return axios.get(`${baseUrl}/search?keywords=${keyword}`)
    // /cloudsearch?keywords= 海阔天空 
    // return axios.get(`${baseUrl}/cloudsearch?keywords=${keyword}`)
}


// 手机登录
export function phoneLogin(phone,password) {
    return axios.get(`${baseUrl}/login/cellphone?phone=${phone}&password=${password} `)
}

// 获取用户的详情
export function userDetail(uid) {
    return axios.get(`${baseUrl}/user/detail?uid=${uid}`)
}


export default {
    getBanner,
    getMusicList,
    getPlaylistDetail,
    getLyric,
    searchMusic,
    phoneLogin,userDetail
}
